using System;
using System.Collections.Generic;
using System.Text;
using Edge.Common.ComponentModel;
using Edge.Common.Services;
using Edge.Common.Utils;
using Edge.Business.Entities;

namespace Dune.Business.Domain.Users
{
    /// <summary>
    /// Users object for NHibernate mapped table 'invites_users'.
    /// </summary>
    [Serializable]
    public class Invite : EntityWithStat<int>
    {
        #region Member Variables

        protected string flowId;
        protected User invitedUser;

        #endregion

        #region Constructors

        public Invite()
        {
//            do
//            {
               flowId = Guid.NewGuid().ToString();
//            } while (Locator.GetService<IInviteManager>().Load(Id) != null);

        }

        public Invite(User invitedUser, User invitedBy)
        {
//            do
//            {
                flowId = Guid.NewGuid().ToString();
//            } while (Locator.GetService<IInviteManager>().Load(Id) != null);
            this.invitedUser = invitedUser;
            this.CreatedBy = invitedBy;
        }

        #endregion

        #region Public Properties

        public virtual string Flow
        {
            get { return flowId; }
            set { flowId = value; }
        } 
        
        
        public virtual User InvitedUser
        {
            get { return invitedUser; }
            set { invitedUser = value; }
        } 
        

    #endregion
        
    }
}
